Skip to content

Count a blank slot value as no value when converting a draft - #1125

Merged
richshaw merged 2 commits into
mainfrom
claude/issue-1098-blank-slot-value
Nov 27, 2026
Merged

richshaw merged 2 commits into
mainfrom
claude/issue-1098-blank-slot-value

Conversation

@richshaw

Copy link
Copy Markdown
Owner

Fixes #1098.

Session: https://claude.ai/code/session_016YZ9SSSFGD1DFqFGwcSq9v

The problem

magicComposeToTemplate (src/lib/magic-compose/to-template.ts) had its own blank check, raw !== undefined && raw !== null && raw !== '', instead of isBlankSlotValue, the rule the rest of the app uses. A value of only spaces got past it, so:

  • the AI connector's create_signup (strict) refused the whole signup with "some values do not fit their fields", blaming the format
  • Magic Compose's "values left blank because they didn't fit" warning counted values that were blank to begin with
  • a blank Number value ('' or ' ') went through Number() and was stored as 0, on both paths

The fix

  • The slot-values loop now skips isBlankSlotValue(raw) before coercing, and counts every other value that doesn't coerce as a failure. One check covers all three effects.
  • coerceValue's own trimming stays, so " Soup " still becomes "Soup" and a non-date is still refused.
  • The golden prompt is untouched. CHANGELOG has a "Fixed" entry, since an assistant's create and the draft banner behave differently.

Tests

  • to-template.test.ts: a slot of " " and one of "" across text, date, time, List and Number fields give no values and no coercion failures (failed on main with { n: 0 } and failures); a real misfit ("tomorrow") beside a blank date is still counted, alone.
  • signups-write.test.ts: create_signup with one slot's date " " no longer refuses (failed on main with the "do not fit" refusal), and hands createSignup that slot without a date. It's a unit test with the service mocked, so it covers strict persistDraft without the database.
  • Ran pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (252 files, 3885 passed, 1 expected fail) and pnpm test:db (47 files, 913 passed): all pass. grep -n "raw !== ''" src/lib/magic-compose finds nothing.

Generated by Claude Code

magicComposeToTemplate kept its own blank check, which let a string of
only spaces through: it was counted as a value that didn't fit, so the
create_signup tool refused the whole signup over it, and a blank Number
value became 0. It now skips blanks with isBlankSlotValue before
coercing, the rule saving, display, grouping and Publish already use.

Fixes #1098.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SSSFGD1DFqFGwcSq9v
@richshaw richshaw added pipeline:tophat pipeline:ux Changes what a person using OpenSignup sees or does pipeline:working A session is working on it right now and removed pipeline:working A session is working on it right now labels Nov 26, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Tophat: passed

See it: https://claude.ai/artifact/LYE1tZXH5MzU5eALNkKo5S
What changes for people: If Magic Compose or an AI assistant leaves a slot's value empty or as spaces, that slot now just has no value there. Before, a blank number showed as 0, the draft's warning counted blanks as values that "didn't fit", and an assistant's create_signup refused the whole signup over one blank date. Values that really don't fit still get a warning or a refusal, as before.

Check Result What I saw
Magic Compose draft with blank values, phone and desktop ✅ Base: "3 values were left blank because they didn't fit their fields", and Servings showed 0 on two slots. Head: no warning and no 0. The other values are unchanged.
Magic Compose draft with one real misfit ("tomorrow" as a date) ✅ Base counted 4 values. Head counts 1, the real misfit.
MCP create_signup, date " " or "" ✅ Base refused with "some values do not fit their fields". Head creates the signup and stores that slot without a date.
MCP create_signup, Number " " ✅ Base stored 0. Head stores no value.
MCP create_signup, real misfit, and a field blank in every slot ✅ "tomorrow" is still refused, with the same error as base. A field that's blank in every slot is refused with "has no value in any slot", as the issue expects.
Console and server log ✅ No browser console errors. The only server errors come from the health check's worker query, because no worker was running.

Not checked: a real AI provider. A local stand-in returned a fixed draft, and the MCP calls used a token from the local OAuth flow.

Ran dca236c against 09127b0 locally, Chromium at 1280×900 and 390×844, made-up data. https://claude.ai/code/session_016YZ9SRunCCu6CzuRivdKqj


Generated by Claude Code

@richshaw richshaw added pipeline:review pipeline:working A session is working on it right now and removed pipeline:tophat pipeline:working A session is working on it right now labels Nov 26, 2026 — with Claude

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: passed (round 1)

The slot-values loop in magicComposeToTemplate now skips isBlankSlotValue(raw) before coercing and counts every other miss as a failure. The issue's outline and "Done when" are all met: the hand-written blank check is gone (grep "raw !== ''" finds nothing), blank Number values no longer reach Number(), the tests cover all five field types with "" and " " plus a real misfit, and the strict create_signup path has a unit test. Non-blank values that don't coerce (a number in a text field, "tomorrow" as a date) are still counted exactly as before.

Blocking (0)
Optional (0)
Earlier threads: none
Checks: CI green on dca236c (lint-type-test, e2e, CodeQL). Tophat passed on this same SHA.

Waits for the owner because it's UX: what an assistant's create_signup returns and what the Magic Compose warning counts both change. Card: https://claude.ai/artifact/LYE1tZXH5MzU5eALNkKo5S. The code itself carries no other risk.

https://claude.ai/code/session_016YZ9SWY5sJ74qKExtrmu2F


Generated by Claude Code

@richshaw richshaw added pipeline:owner Passed; waits for the owner (UX or high-risk) and removed pipeline:review pipeline:working A session is working on it right now labels Nov 26, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Approved by the owner at dca236c.

https://claude.ai/code/session_016YZ9SVfNPHkNsZgUBaTPSS


Generated by Claude Code

@richshaw richshaw added pipeline:merge pipeline:working A session is working on it right now and removed pipeline:owner Passed; waits for the owner (UX or high-risk) labels Nov 27, 2026 — with Claude
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SW9wbz4ipqewrnw7B5
@richshaw
richshaw merged commit a820439 into main Nov 27, 2026
5 checks passed
@richshaw
richshaw deleted the claude/issue-1098-blank-slot-value branch November 27, 2026 12:13
@richshaw richshaw removed pipeline:merge pipeline:ux Changes what a person using OpenSignup sees or does pipeline:working A session is working on it right now labels Nov 27, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants